<?php

namespace App\Http\Controllers;

use Qiniu\Auth;


class UploadController extends WxBaseController
{
    protected $except=['index'];
    //生成七牛token
    public function index()
    {
        $accessKey = config('access_key');
        $secretKey = config('secret_key');
        $bucket = config('bucket');
        $domain = config('domain');
        $region = config('region');
        // 构建鉴权对象
        $auth = new Auth($accessKey, $secretKey);
        // 生成上传 Token
        $token = $auth->uploadToken($bucket);
        return $this->apiReturn(true, 'success',['token'=>$token,'domain'=>$domain,'region'=>$region]);
    }
}
